package com.likou.arr;

/**
 * Created by HXT on 2019/7/29.
 */
public class RemoveDuplicates {
    public static int removeDuplicates(int[] nums) {
        if(nums.length==0){
            return 0;
        }
        int length = 0;
        for(int i=1;i<nums.length;i++){
            if(nums[i]>nums[length]){
                length++;
                nums[length]=nums[i];
            }
        }
        return 1+length;
    }
    public static void main(String[] args){
        int [] nums = {0,0,1,1,1,2,2,3,3,4};
        System.out.println(RemoveDuplicates.removeDuplicates(nums));
    }
}
